// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIPluginHost.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    ///This Source Code Form is subject to the terms of the Mozilla Public
    /// License, v. 2.0. If a copy of the MPL was not distributed with this
    /// file, You can obtain one at http://mozilla.org/MPL/2.0/. </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("9c311778-7c2c-4ad8-b439-b8a2786a20dd")]
	public interface nsIClearSiteDataCallback
	{
		
		/// <summary>
        /// callback with the result from a call to clearSiteData
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Callback(int rv);
	}
	
	/// <summary>nsIPluginHost </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("f938f5ba-7093-42cd-a559-af8039d99204")]
	public interface nsIPluginHost
	{
		
		/// <summary>
        /// Causes the plugins directory to be searched again for new plugin
        /// libraries.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ReloadPlugins();
		
		/// <summary>Member GetPluginTags </summary>
		/// <param name='aPluginCount'> </param>
		/// <returns>A System.IntPtr</returns>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		System.IntPtr GetPluginTags(ref uint aPluginCount);
		
		/// <summary>
        /// Clear site data for a given plugin.
        ///
        /// @param plugin: the plugin to clear data for, such as one returned by
        /// nsIPluginHost.getPluginTags.
        /// @param domain: the domain to clear data for. If this argument is null,
        /// clear data for all domains. Otherwise, it must be a domain
        /// only (not a complete URI or IRI). The base domain for the
        /// given site will be determined; any data for the base domain
        /// or its subdomains will be cleared.
        /// @param flags: a flag value defined above.
        /// @param maxAge: the maximum age in seconds of data to clear, inclusive. If
        /// maxAge is 0, no data is cleared; if it is -1, all data is
        /// cleared.
        ///
        /// @throws NS_ERROR_INVALID_ARG if the domain argument is malformed.
        /// @throws NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED if maxAge is a value other
        /// than -1 and the plugin does not support clearing by timerange in
        /// general or for that particular site and/or flag combination.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ClearSiteData([MarshalAs(UnmanagedType.Interface)] nsIPluginTag plugin, [MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase domain, ulong flags, long maxAge, [MarshalAs(UnmanagedType.Interface)] nsIClearSiteDataCallback callback);
		
		/// <summary>
        /// Determine if a plugin has stored data for a given site.
        ///
        /// @param plugin: the plugin to query, such as one returned by
        /// nsIPluginHost.getPluginTags.
        /// @param domain: the domain to test. If this argument is null, test if data
        /// is stored for any site. The base domain for the given domain
        /// will be determined; if any data for the base domain or its
        /// subdomains is found, return true.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool SiteHasData([MarshalAs(UnmanagedType.Interface)] nsIPluginTag plugin, [MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase domain);
		
		/// <summary>
        /// Get the "permission string" for the plugin.  This is a string that can be
        /// passed to the permission manager to see whether the plugin is allowed to
        /// run, for example.  This will typically be based on the plugin's "nice name"
        /// and its blocklist state.
        ///
        /// @mimeType The MIME type we're interested in.
        /// @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetPermissionStringForType([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase mimeType, uint excludeFlags, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase retval);
		
		/// <summary>
        /// Get the nsIPluginTag for this MIME type. This method works with both
        /// enabled and disabled/blocklisted plugins, but an enabled plugin will
        /// always be returned if available.
        ///
        /// A fake plugin tag, if one exists and is available, will be returned in
        /// preference to NPAPI plugin tags unless excluded by the excludeFlags.
        ///
        /// @mimeType The MIME type we're interested in.
        /// @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
        ///
        /// @throws NS_ERROR_NOT_AVAILABLE if no plugin is available for this MIME
        /// type.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIPluginTag GetPluginTagForType([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase mimeType, uint excludeFlags);
		
		/// <summary>
        /// Get the nsIPluginTag enabled state for this MIME type.  See
        /// nsIPluginTag.enabledState.
        ///
        /// @mimeType The MIME type we're interested in.
        /// @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetStateForType([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase mimeType, uint excludeFlags);
		
		/// <summary>
        /// Get the blocklist state for a MIME type.  See nsIPluginTag.blocklistState.
        ///
        /// @mimeType The MIME type we're interested in.
        /// @excludeFlags Set of the EXCLUDE_* flags above, defaulting to EXCLUDE_NONE.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetBlocklistStateForType([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase aMimeType, uint excludeFlags);
		
		/// <summary>
        /// Create a fake plugin tag, register it, and return it.  The argument is a
        /// FakePluginTagInit dictionary.  See documentation in
        /// FakePluginTagInit.webidl for what it should look like.  Will throw
        /// NS_ERROR_UNEXPECTED if there is already a fake plugin registered with the
        /// given handler URI.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIFakePluginTag RegisterFakePlugin(ref Gecko.JsVal initDictionary, System.IntPtr jsContext);
		
		/// <summary>
        /// Get a reference to an existing fake plugin tag for the given MIME type, if
        /// any.  Can return null.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIFakePluginTag GetFakePlugin([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase mimeType);
		
		/// <summary>
        /// Unregister a fake plugin.  The argument can be the .handlerURI.spec of an
        /// existing nsIFakePluginTag, or just a known handler URI string that was
        /// passed in the FakePluginTagInit when registering.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void UnregisterFakePlugin([MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase handlerURI);
	}
	
	/// <summary>nsIPluginHostConsts </summary>
	public class nsIPluginHostConsts
	{
		
		// <summary>
        // Flags for use with clearSiteData.
        //
        // FLAG_CLEAR_ALL: clear all data associated with a site.
        // FLAG_CLEAR_CACHE: clear cached data that can be retrieved again without
        // loss of functionality. To be used out of concern for
        // space and not necessarily privacy.
        // </summary>
		public const long FLAG_CLEAR_ALL = 0;
		
		// 
		public const long FLAG_CLEAR_CACHE = 1;
		
		// <summary>
        // For use with Get*ForType functions
        // </summary>
		public const long EXCLUDE_NONE = 0;
		
		// 
		public const long EXCLUDE_DISABLED = 1<<0;
		
		// 
		public const long EXCLUDE_FAKE = 1<<1;
	}
}
